package com.test.date.beforeJava8;


import java.time.LocalDate;
import java.time.Period;
import java.time.ZoneId;
import java.util.Set;

/**
 * @Description:
 * @Author: yangzhiwei
 * @Date: 2020/11/24 11:13
 */
public class DateSummary {
    public static void main(String[] args) {
        //对时间日期类的总结
        LocalDate localDate1 = LocalDate.of(1990,11,12);
        LocalDate localDate = LocalDate.now();
        System.out.println(localDate);
        //Long timeStamp =
        Period period = Period.between(localDate1,localDate);
        System.out.println(period.getMonths());
        System.out.println(period.getYears());
        System.out.println(period.getDays());
        System.out.println(localDate.getYear());
        System.out.println(localDate1.getChronology());
        System.out.println(localDate1.atStartOfDay());
       // System.out.println(ZoneId.getAvailableZoneIds());
        Set zoneIds = ZoneId.getAvailableZoneIds();
        zoneIds.spliterator().forEachRemaining(zoneId ->{
            String curZoneId = (String)zoneId;
            //System.out.println(zoneId);
            if (curZoneId.contains("Shanghai"))
            System.out.println(zoneId);
        });



        //JDK 内置 ：时间转特定格式字符串方便，但字符串必须严格符合格式 如 MM->01
    }
}
